
<div class="subheader" ng-if="model.decisionTable">
	<div class="fixed-container">
		<div class="btn-group pull-right" ng-if="!(currentKickstartModel)">
			<button type="button" class="btn btn-default" ng-click="openEditor()" ng-if="model.decisionTable.latestVersion">
				<i class="glyphicon glyphicon-edit icon-and-label"></i> {{'DECISION-TABLE.ACTION.OPEN-IN-EDITOR' | translate}}
			</button>
			<button type="button" class="btn btn-default" ng-click="useAsNewVersion()" ng-if="!model.decisionTable.latestVersion">
				{{'DECISION-TABLE.ACTION.USE-AS-NEW-VERSION' | translate}}
			</button>
		</div>

		<div class="btn-group pull-right" ng-if="!(currentKickstartModel)">
			<button type="button" ng-click="toggleFavorite()" class="btn btn-default" title="{{'DECISION-TABLE.ACTION.FAVORITE' | translate}}"
			    title="{{'DECISION-TABLE.ACTION.FAVORITE' | translate}}" ng-disabled="!model.decisionTable.latestVersion || model.favoritePending">
				<i class="glyphicon" ng-class="{'glyphicon-star highlight': model.decisionTable.favorite, 'glyphicon-star-empty': !model.decisionTable.favorite}"></i>
			</button>
			<button type="button" ng-click="shareDecisionTable()" class="btn btn-default" title="{{'DECISION-TABLE.ACTION.SHARE' | translate}}"
			    title="{{'DECISION-TABLE.ACTION.SHARE' | translate}}" ng-disabled="!model.decisionTable.latestVersion || model.decisionTable.createdBy != account.id">
				<i class="glyphicon glyphicon-share"></i>
			</button>
			<a href="{{model.decisionTableDownloadUrl}}" class="btn btn-default" title="{{'DECISION-TABLE.ACTION.EXPORT' | translate}}">
 	            <i class="glyphicon glyphicon-save"></i>
 	        </a>
		</div>

		<div class="btn-group pull-right" ng-if="!(currentKickstartModel)">
			<button type="button" class="btn btn-default" ng-click="editDecisionTable()" ng-disabled="!model.decisionTable.latestVersion"
				title="{{'DECISION-TABLE.ACTION.EDIT' | translate}}">
				<i class="glyphicon glyphicon-pencil"></i>
			</button>
			<button type="button" class="btn btn-default" ng-click="duplicateDecisionTable()" ng-disabled="!model.decisionTable.latestVersion"
					title="{{'DECISION-TABLE.ACTION.DUPLICATE' | translate}}">
				<i class="editor-icon editor-icon-copy"></i>
			</button>
			<button type="button" class="btn btn-default" ng-click="deleteDecisionTable()" title="{{'DECISION-TABLE.ACTION.DELETE' | translate}}"
				 title="{{'DECISION-TABLE.ACTION.DELETE' | translate}}" ng-disabled="!model.decisionTable.latestVersion">
				<i class="glyphicon glyphicon-trash"></i>
			</button>
		</div>		
		<div class="pull-right" ng-if="!(currentKickstartModel)">
			<a ng-click="returnToList()" class="action">&larr; {{'GENERAL.ACTION.RETURN-TO-LIST' | translate}}</a>
		</div>

		<h2><span class="version">v{{model.decisionTable.version}}</span>{{model.decisionTable.name}}</h2>
		<div class="clearfix">
			<div class="col-xs-4 details">
				<span><i class="glyphicon glyphicon-user"></i><span translate="DECISION-TABLE.DETAILS.CREATED-BY" translate-values="model.decisionTable"></span></span>
				<span><i class="glyphicon glyphicon-pencil"></i><span translate="DECISION-TABLE.DETAILS.LAST-UPDATED-BY" translate-values="model.decisionTable"></span></span>
			</div>
			<div class="col-xs-8 details clearfix">
			    <div class="related btn-group">
					<button id="toggle-comment" type="button" class="btn btn-subtle" ng-disabled="!model.decisionTable.latestVersion" ng-click="toggleComments($event)"
						title="{{'DECISION-TABLE.ACTION.ADD-COMMENT' | translate}}">
                        <span ng-if="!model.comments.data.length">
						    {{'DECISION-TABLE.ACTION.ADD-COMMENT' | translate}}
                        </span>
                        <span ng-if="model.comments.data.length">
						    {{'DECISION-TABLE.DETAILS.COMMENTS-TITLE' | translate}} <span class="counter">{{model.comments.data.length}}</span>
                        </span>
					</button>
					<button id="toggle-history" ng-if="!(currentKickstartModel)" type="button" class="btn btn-subtle" ng-click="toggleHistory($event)"
						title="{{'DECISION-TABLE.ACTION.EDIT' | translate}}">
						{{'DECISION-TABLE.DETAILS.HISTORY-TITLE' | translate}} <span class="counter" ng-show="model.versions.data.length">{{model.versions.data.length}}</span>
					</button>
				</div>
				<p ng-if="model.decisionTable.description">
					{{model.decisionTable.description}}
				</p>
				<span class="detail" ng-if="model.decisionTable.comment" title="{{'DECISION-TABLE.VERSION-COMMENT' | translate}}"><i class="glyphicon glyphicon-comment"></i>{{model.decisionTable.comment}}</span>
			</div>
		</div>
	</div>
</div>
<div class="container-fluid content decision-table" ng-if="model.decisionTable" auto-height offset="40">

    <br/>
    <div class="row" ng-if="currentDecisionTable.hitIndicator">
        <div class="col-xs-6">
            <div class="form-group">
                <label>{{'DECISION-TABLE.HIT-POLICY' | translate}} {{'DECISION-TABLE.HIT-POLICIES.' + currentDecisionTable.hitIndicator | translate}}</label>
            </div>
        </div>
    </div>

    <div class="decision-table-grid-wrapper">
        <div id="decisionTableGrid" class="decision-table-grid" ui-grid="gridOptions" ui-grid-selection  ui-grid-cellnav ui-grid-auto-resize></div>
    </div>

</div>
